﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BattleShips.Common;

namespace BattleShips.GameServers.CommandRunners {
    class CreateRoom : ICommandRunner {
        public string RunCommand(Command command, TestServer.GameClient client, TestServer.GameServer server) {
            GameRoom gameRoom = new GameRoom();
            gameRoom.AddMasterClient(client);
            gameRoom.RoomAdminId = client.IdPlayer;
            gameRoom.RoomName = command.Argument;
            gameRoom.RStatus = "Open";
            gameRoom.idRoom = client.IdPlayer;
            server.CreateNewRoom(gameRoom,client);
            return string.Format("GameId:{0} |---| RoomName:{1} |---| ClientId:{2} |---| RoomStatus:{3}", gameRoom.idRoom, gameRoom.RoomName, gameRoom.RoomAdminId, gameRoom.RStatus);
        }
    }
}
